package br.com.knowledge.helper;

import java.io.File;
import java.io.IOException;
import java.util.Properties;

import org.apache.commons.io.FileUtils;

import br.com.knowledge.persistence.hibernate.entities.CadLinguagem;

public class LoadRegexFilters {
	private Properties properties = null;
	
	
	private Properties loadProperties(CadLinguagem linguagem) {
		String propFileName = linguagem.getNmlinguagem().concat(".properties");
		File propFile = new File("C:\\Users\\Cinq\\Workspaces\\david\\project\\knowledge\\WebRoot\\WEB-INF\\linguagens\\"+propFileName);
		if(propFile.exists()){
			properties = new Properties();
			try {
				properties.load(FileUtils.openInputStream(propFile));
			} catch (IOException e) {
				e.printStackTrace();
				properties = null;
			}
		}
		
		return properties;
	}
	
	public static Properties getProperties(CadLinguagem linguagem){
		return (new LoadRegexFilters()).loadProperties(linguagem);
	
	}
	
}
